/* eslint-disable */
const validator = {
    patterns: {
        email: {
            pattern: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
            desc : "电子邮箱"
        },
        url: {
            pattern: /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i,
            desc : "网址"
        },
        date: {
            pattern: /^[1-2][0-9][0-9][0-9]-[0-1]{0,1}[0-9]-[0-3]{0,1}[0-9]$/,
            desc : "日期"
        },
        number: {
            pattern: /^[0-9]+([.]{1}[0-9]+){0,1}$/,
            desc : "数值"
        },
        integer: {
            pattern: /^-?\d+$/,
            desc : "整数"
        },
        digits: {
            pattern: /^(0|\+?[1-9][0-9]*)$/,
            desc : "正整数"
        },
        abc: {
            pattern: /^\w+$/,
            desc : "字母数字下划线"
        },
        mobile: {
            pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/,
            desc : "手机号"
        },
        simplePhone: {
            pattern: /^0\d{2}-\d{7,8}$/,
            desc: "固定号码"
        },
        phone: {
            pattern: /^(0\d{2}-\d{7,8})|((0|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8})$/,
            desc: "手机或电话"
        },
        zipCode: {
            pattern: /^[1-9]\d{5}(?!\d)$/,
            desc : "邮编"
        },
        ipv4: {
            pattern: "",
            desc: "IPV4"
        },
        ipv6: {
            pattern: "",
            desc: "IPV6"
        },
        idcard: {
            pattern: /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/,
            desc : "身份证号"
        },

      //最多两位小数
        decimal2: {
          pattern: /^\d+(?:\.\d{0,2})?/,
          desc : "最多两位小数"
        }
    }
}

export default validator
